package com.lagou.edu.controller;

import com.lagou.edu.service.AuthCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author
 */
@CrossOrigin
@RequestMapping("/code")
@RestController
public class AuthCodeController {

    @Autowired
    private AuthCodeService authCodeService;

    @GetMapping("/create/{email}")
    public Boolean create(@PathVariable String email){
        return authCodeService.createAuthCode(email);
    }

    @GetMapping("/validate/{email}/{code}")
    public Integer validate(@PathVariable String email, @PathVariable String code){
        return authCodeService.validate(email, code);
    }

}
